# from .serializers import UserModelSerializers
def jwt_response_payload_handler(token, user=None, request=None):
    """
    自定义jwt认证成功返回数据
    :token  返回的jwt
    :user   当前登录的用户信息[对象]
    :request 当前本次客户端提交过来的数据
    """
    return {
        "msg": "success",
        "status": 200,
        "data": [{
            # data自定义你接口想返回的信息
            'authenticated': True,
            'token': token,
            'id': user.id,
            'username': user.username,
            # 'user': UserModelSerializers(user).data
        }]
    }


def jwt_response_payload_error_handler(serializer, request=None):
    return {
        "msg": "用户名或者密码错误",
        "status": 400,
        "detail": serializer.errors
      }
